package export.pet
{
	import com.dusk.util.McUtil;
	import com.dusk.util.TextUtil;
	import com.game.data.vo.PetDataVO;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	public class ShowPetInfo extends Sprite
	{
		
		public function ShowPetInfo()
		{
			super();
			TextUtil.redrawTxtOld(this, this.needRedrawText);
		}
		
		public var headmc:MovieClip;
		public var txtlevel:TextField;
		public var txthp:TextField;
		public var txtmp:TextField;
		public var hpmc:MovieClip;
		public var mpmc:MovieClip;
		private var pif:PetDataVO;
		private var needRedrawText:Array = ["txthp", "txtmp", "txtlevel"];
		
		public function setPetInfo(param1:PetDataVO):void
		{
			this.pif = param1;
		}
		
		public function flipHorizontalTxt(param1:uint):void
		{
			if (param1 == 2)
			{
				McUtil.flipHorizontal(this.txthp, -1);
				this.txthp.x = 140;
				McUtil.flipHorizontal(this.txtmp, -1);
				this.txtmp.x = 140;
				McUtil.flipHorizontal(this.txtlevel, -1);
				this.txtlevel.x = 25;
			}
		}
		
		public function show():void
		{
			if (this.pif)
			{
				this.pif.transPetChinaSkillName(this.pif.petName);
				this.headmc.gotoAndStop(this.pif.petChinaName);
				this.txtlevel.text = this.pif.level.toString();
				this.txthp.text = this.pif.hp + "/" + this.pif.hpMax;
				this.hpmc.gotoAndStop(25 - Math.round(25 * Number(this.pif.hp) / Number(this.pif.hpMax)));
				this.txtmp.text = this.pif.mp + "/" + this.pif.mpMax;
				this.mpmc.gotoAndStop(25 - Math.round(25 * Number(this.pif.mp) / Number(this.pif.mpMax)));
			}
		}
	}
}
